package com.codi.bus.core.fund.enums;

import com.codi.base.util.EqualsUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * 模块名
 *
 * @author spy
 * @version 1.0 2018-01-25
 * @since 1.0
 */
public enum DividendAutoBuyEnum {

    REINVESTMENT("0", "红利再投资"),
    CASH("1", "现金红利");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String label;


    DividendAutoBuyEnum(String key, String label) {
        this.key = key;
        this.label = label;
    }

    public static Boolean has(String key) {
        DividendAutoBuyEnum[] values = DividendAutoBuyEnum.values();

        for (int i = 0; i < values.length; i++) {
            DividendAutoBuyEnum item = values[i];

            if (EqualsUtil.equals(item.getKey(), key)) {
                return Boolean.TRUE;
            }
        }
        return Boolean.FALSE;
    }


}
